Skip to content

feat(vmcp): add support for ResourceLink content type#4023

Merged
amirejaz merged 3 commits intostacklok:mainfrom
Sanskarzz:suppResourceLink
Mar 18, 2026
Merged

feat(vmcp): add support for ResourceLink content type#4023
amirejaz merged 3 commits intostacklok:mainfrom
Sanskarzz:suppResourceLink

Conversation

@Sanskarzz
Copy link
Copy Markdown
Contributor

@Sanskarzz Sanskarzz commented Mar 5, 2026

Summary

This PR implements support for the ResourceLink content type (type discriminant "resource_link") in the vMCP bridge layer. Previously, ResourceLink content returned by backend MCP servers was unrecognized by the conversion layer, causing it to fall through to "unknown" and eventually be emitted as empty text, losing critical resource pointers and metadata.

Key Changes

  • Core Types: Extended vmcp.Content in pkg/vmcp/types.go to include Name and Description fields, allowing it to faithfully represent a ResourceLink .
  • Conversion Layer: Added contentTypeLink constant to pkg/vmcp/conversion/content.go. Updated ConvertMCPContent to detect mcp.ResourceLink via type assertion and map it to vmcp.Content. Updated ToMCPContent to reconstruct mcp.ResourceLink using mcp.NewResourceLink.
  • Tests: Added new test cases to TestConvertMCPContent and TestToMCPContent in conversion_test.go. Added TestResourceLinkRoundTrip to verify that data is preserved when converting in both directions.

Validation Results

All tests in pkg/vmcp/conversion and pkg/vmcp/server/adapter pass. go vet is clean.

Fixes #3960

@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Mar 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.03%. Comparing base (837906c) to head (b0b7f56).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/vmcp/conversion/content.go 66.66% 1 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4023      +/-   ##
==========================================
- Coverage   69.04%   69.03%   -0.01%     
==========================================
  Files         468      468              
  Lines       47003    47014      +11     
==========================================
+ Hits        32453    32457       +4     
+ Misses      11974    11945      -29     
- Partials     2576     2612      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sanskarzz Sanskarzz marked this pull request as ready for review March 6, 2026 19:39
@jerm-dro
Copy link
Copy Markdown
Contributor

jerm-dro commented Mar 7, 2026

Hey @Sanskarzz thanks for the PR. I notice "[WIP]" in the PR description. Is this ready for review?

jerm-dro
jerm-dro previously approved these changes Mar 7, 2026
Comment thread pkg/vmcp/types.go Outdated
@Sanskarzz
Copy link
Copy Markdown
Contributor Author

Sanskarzz commented Mar 8, 2026

Hey @Sanskarzz thanks for the PR. I notice "[WIP]" in the PR description. Is this ready for review?

Apologies, my bad. The PR is ready to review.

@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 8, 2026
@Sanskarzz Sanskarzz requested a review from jerm-dro March 9, 2026 09:34
jerm-dro
jerm-dro previously approved these changes Mar 9, 2026
@JAORMX
Copy link
Copy Markdown
Collaborator

JAORMX commented Mar 18, 2026

These look ready to go, mind resolving the merge conflicts? we can merge then.

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 18, 2026
@Sanskarzz
Copy link
Copy Markdown
Contributor Author

Sanskarzz commented Mar 18, 2026

These look ready to go, mind resolving the merge conflicts? we can merge then.

@JAORMX Done, Now its ready to merge.

@amirejaz amirejaz merged commit ee3c003 into stacklok:main Mar 18, 2026
58 of 59 checks passed
Sanskarzz added a commit to Sanskarzz/toolhive that referenced this pull request Mar 23, 2026
* feat(vmcp): add support for ResourceLink content type

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>

* fix: added ContentType as a string alias in types.go

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>

* fix: lint

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>

---------

Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ResourceLink content type support to vmcp bridge

4 participants